class Person:
    def __init__(self, name, age,gender):
        self.name = name
        self.age = age
        self.gender = gender

    def introduce(self):
        return f"大家好，我叫{self.name},今年 {self.age}岁，是 {self.gender}生"
#学生类，继承自Person类
class Student(Person):
    def __init__(self, name, age, gender,student_id, grade):
        super().__init__(name, age, gender)
        self.grade = grade
        self.student_id = student_id
        self.courses = []

    def introduce(self):
        return f"大家好,我叫{self.name},学号是{self.student_id}，我的年级是{self.grade}"
    
    def enroll_course(self, course):
        if course not in self.courses:
            self.courses.append(course)
            course.add_student(self)
            return f"{self.name}成功选修了{course.name}课程."
        return f"{self.name}已选修了{course.name}课程."


    def list_courses(self):
        if self.courses:
            course_name=[course.name for course in self.courses]
            return f"{self.name}已选修的课程有：{', '.join(course_name)}"
        return f"{self.name}目前没有选修任何课程."
class Course:
    def __init__(self, name):
        self.name = name
    
    def __str__(self):
        return f"Course: {self.name}"
#创建一个Administrator类,继承自Person类，添加管理学习的相关方法
class Administrator(Person):
    def __init__(self, name, age, gender, staff_id):
        super().__init__(name, age, gender)
        self.staff_id = staff_id

    def introduce(self):
        return f"大家好,我叫{self.name},工号是{self.staff_id}"

    def create_course(self, course_name):
        return Course(course_name)
#为学习系统添加一个Grade类，用于管理同一年级的学生和课程
class Grade:
    def __init__(self, grade):
        self.grade = grade
        self.students = []
        self.courses = []

    def add_student(self, student):
        if student not in self.students:
            self.students.append(student)
            student.grade = self.grade

    def add_course(self, course):
        if course not in self.courses:
            self.courses.append(course)